home *** CD-ROM | disk | FTP | other *** search
/ L' Effet Pommier 3 / L'Effet Pommier - Volume 03.iso / Programmation / Alpha ƒ / Tcl / SystemCode / browser.tcl < prev    next >
Text File  |  1996-01-05  |  1KB  |  49 lines

  1. #=============================================================================
  2. # Browser mode.
  3. #=============================================================================
  4. proc dummyBrws {} {}
  5.  
  6. proc upBrowse {} {
  7.     set limit [nextLineStart [nextLineStart 0]]
  8.     if {[getPos] > $limit} {
  9.         set limit [expr [getPos] - 1]
  10.     }
  11.     select [lineStart $limit] [nextLineStart $limit]
  12. }
  13.  
  14. proc downBrowse {} {
  15.     set pos [getPos]
  16.     if {$pos < [nextLineStart 0]} {
  17.         set pos [nextLineStart 0]
  18.     }
  19.     if {[nextLineStart $pos] != [maxPos]} {
  20.         select [nextLineStart $pos] [nextLineStart [nextLineStart $pos]]
  21.     }
  22. }
  23.  
  24. proc nextMatch {{wname "*Batch Find*"}} {
  25.     set wins [winNames]
  26.     set res [lsearch $wins $wname]
  27.     if {$res < 0} {
  28.         set res [lsearch -regexp $wins {\*.*\*}]
  29.         if {$res < 0} return
  30.     }
  31.     set win [lindex $wins $res]
  32.     bringToFront $win
  33.     downBrowse
  34.     gotoMatch
  35.     dispErr $win
  36. }
  37.  
  38. bind '\r'        gotoMatch    Brws
  39. bind enter        gotoMatch    Brws
  40. ascii 0x3          gotoMatch   Brws
  41. bind down         downBrowse Brws
  42. bind up         upBrowse Brws
  43. bind 'n' <z>    downBrowse Brws
  44. bind 'p' <z>    upBrowse Brws
  45. ascii 0x20        downBrowse Brws
  46. ascii 0x8        upBrowse Brws
  47.  
  48.  
  49.